<?xml version="1.0" encoding="UTF-8" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:t="http://myfaces.apache.org/tomahawk">

<h:body>
	<ui:composition template="../../templates/general.xhtml">
		<ui:define name="content">

			<f:metadata>
				<f:viewParam id="template_id" name="id"
					value="#{emailTemplateCrudBean.id}" />
				<f:viewParam id="mode" name="mode"
					value="#{emailTemplateCrudBean.mode}" />
			</f:metadata>

			<f:event type="preRenderView"
				listener="#{emailTemplateCrudBean.init}" />

			<h1 class="page-header">
				<i class="fa fa-envelope fa-3"></i> Email Template
			</h1>
			<h:panelGrid>
				<p:growl id="messages" showDetail="true" autoUpdate="true" />
				<p:panel styleClass="jumbotron" style="width:1024px;">

					<h:panelGrid columns="4" columnClasses="first,second">
						<h:outputLabel for="nome" value="Nome:" style="font-size: 0.9em;" />
						<p:inputText id="nome"
							value="#{emailTemplateCrudBean.template.nome}"
							style="width:400px; font-size: 0.9em;"
							disabled="#{emailTemplateCrudBean.disableComponent}" />

						<h:outputLabel for="assunto" value="Assunto:"
							style="font-size: 0.9em;" />
						<p:inputText id="assunto"
							value="#{emailTemplateCrudBean.template.assunto}"
							style="width:400px; font-size: 0.9em;"
							disabled="#{emailTemplateCrudBean.disableComponent}" />

						<h:outputLabel for="ddlCategoria" value="Categoria:"
							style="font-size: 0.9em;" />
						<p:selectOneMenu id="ddlCategoria"
							value="#{emailTemplateCrudBean.idCategoria}"
							disabled="#{emailTemplateCrudBean.disableComponent}"
							style="font-size: 0.9em;">
							<f:selectItem itemLabel="Seleccione" itemValue="" />
							<f:selectItems value="#{emailTemplateCrudBean.listaCategorias}"
								var="c" itemLabel="#{c.nome}" itemValue="#{c.id}" />
						</p:selectOneMenu>
					</h:panelGrid>
				</p:panel>

				<p:column colspan="4">
					<p:editor id="editor"
						value="#{emailTemplateCrudBean.template.texto}" required="true"
						disabled="#{emailTemplateCrudBean.disableComponent}" />
				</p:column>

			</h:panelGrid>

			<h3 class="page-header"></h3>

			<p:commandButton id="editar" value="Editar"
				action="#{emailTemplateCrudBean.editar}" ajax="false"
				rendered="#{emailTemplateCrudBean.renderBotaoEditar}"
				style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />
			<p:commandButton id="voltar" value="Voltar"
				action="#{emailTemplateCrudBean.voltar}" ajax="false"
				rendered="#{emailTemplateCrudBean.renderBotaoVoltar}"
				style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />
			<p:commandButton id="eliminar" value="Eliminar"
				action="#{emailTemplateCrudBean.apagar}" ajax="false"
				rendered="#{emailTemplateCrudBean.renderBotaoApagar}"
				style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />
			<p:commandButton id="gravar" value="Gravar"
				action="#{emailTemplateCrudBean.gravar}" ajax="false"
				rendered="#{emailTemplateCrudBean.renderBotaoGravar}"
				style="margin-right: 10px; margin-bottom: 50px; float:right; font-size: 0.9em;" />

		</ui:define>
	</ui:composition>
</h:body>
</html>